<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="renderer" content="webkit">
  <title></title>
  <link rel="stylesheet" href=" __PUBLIC__/Admin/css/pintuer.css">
  <link rel="stylesheet" href=" __PUBLIC__/Admin/css/admin.css">
  <link rel="stylesheet" href="__PUBLIC__/editor/css/editormd.min.css" />
  <script src="__PUBLIC__/Admin/js/jquery.js"></script>
  <script src="__PUBLIC__/Admin/js/pintuer.js"></script>
  <script src="__PUBLIC__/js/jquery-2.0.2.js"></script>
  <script src="__PUBLIC__/Admin/js/upload.js"></script>
  <style>
    .nylDate{
      width: 147px;
      height: 43px;
      margin-left: 25px;
      border: solid 1px #ddd;
    }
    input[type=date]::-webkit-inner-spin-button { visibility: hidden; }
    ::-webkit-datetime-edit { padding: 1px; background: url(../selection.gif); }
    /*::-webkit-datetime-edit-fields-wrapper { background-color: #eee; }*/
    ::-webkit-datetime-edit-text { color: #4D90FE; padding: 0 .3em; }
    /*::-webkit-datetime-edit-year-field { color: purple; }
    ::-webkit-datetime-edit-month-field { color: blue; }
    ::-webkit-datetime-edit-day-field { color: green; } */
    ::-webkit-inner-spin-button { visibility: hidden; }
    ::-webkit-calendar-picker-indicator {
      border: 1px solid #ccc;
      border-radius: 2px;
      box-shadow: inset 0 1px #fff, 0 1px #eee;
      /*background-color: #eee;*/
      background-image: -webkit-linear-gradient(top, #f0f0f0, #e6e6e6);
      color: #666;
    }
  </style>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>修改文章</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" >
      <input type="hidden" name="aid" value="{$art['aid']}">
      <div class="form-group">
        <div class="label">
          <label>文章标题：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="{$art['title']}" name="title" data-validate="required:请输入标题" />
          <div class="tips"></div>
          <div class="label">
            <label>文章分类：</label>
          </div>
          <select name="cid" class="input w50">
            <option value="0">请选择分类</option>
            <foreach name="cats" item="c" >
            <option value="{$c['cid']}" <if condition="$c[cid] eq $art[cid]">selected="selected"</if>>{$c['cname']}</option>
            </foreach>
          </select>
            <div class="label">
            <label>日期：</label>
          </div>
          <input type="date" class="nylDate" id="mydate" name="ymd" value="{$art['ymd']}"/>
          <div class="tips"></div>
        </div>
      </div>
      <eq name="art.cid" value="5">
      <div class="form-group">
        <div class="label">
          <label>文章内容片段：</label>
        </div>
        <div class="field">
          <textarea  name="content" class="txt" data-validate="required:*请输入文章内容">{$art.content}</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>视频封面：</label>
        </div>
        <div class="field">
          <!-- <div class="input w50" data-validate="required:请选择图片">选择图片</div> -->
          <div class="input  field  upload">
            <img id="show_img1" src="{$art.pic1|default='__PUBLIC__/Admin/images/default.png'}" alt="">
            <input type="file" id="pic1" class="pic"  val=""/>
            <input type="hidden" name="pic1" value="{$art.pic1}">
          </div>
          <eq name="art.cid" value="5">
                <input type="text" style="width:85%"class="input w100" value="{$art.video_link}" name="video_link" data-validate="required:*请上传图片并添加批注" placeholder="*请输入视频地址" />
            </eq>
          <input type="text" style="width:85%"class="input w100" value="{$art.discrip1}" name="discrip1" data-validate="required:*请上传图片并添加批注" placeholder="*请输入图片批注" />
          <div class="tips"></div>
        </div>
      </div>
      <else/>
      <div>
        <div class="form-group">
          <div class="label">
            <label>文章内容片段：</label>
          </div>
          <div class="field">
            <textarea  name="content" class="txt" data-validate="required:*请输入文章内容">{$art.content}</textarea>
            <div class="tips"></div>
          </div>
        </div>
        <!--片段一-->
        <div class="form-group">
          <div class="label">
            <label>文章图片：</label>
          </div>
          <div class="field">
            <div class="input  field  upload">
              <img id="show_img1" src="{$art.pic1|default='__PUBLIC__/Admin/images/default.png'}" alt="">
              <input type="file" id="pic1" class="pic"  val=""/>
              <input type="hidden" name="pic1" value="{$art.pic1}">
            </div>
            <eq name="art.cid" value="5">
              <input type="text" style="width:85%"class="input w100" value="{$art.video_link}" name="video_link" data-validate="required:*请上传图片并添加批注" placeholder="*请输入视频地址" />
            </eq>
            <input type="text" style="width:85%"class="input w100" value="{$art.discrip1}" name="discrip1" data-validate="required:*请上传图片并添加批注" placeholder="*请输入图片批注" />
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>文章内容片段：</label>
          </div>
          <div class="field">
            <textarea  name="content1" class="txt" >{$art.content1}</textarea>
            <div class="tips"></div>
          </div>
        </div>
        <!--片段一-->
        <!--片段二-->
          <div class="form-group">
            <div class="label">
              <label>文章图片：</label>
            </div>
            <div class="field">
              <!-- <div class="input w50" data-validate="required:请选择图片">选择图片</div> -->
              <div class="input  field  upload">
                <img id="show_img2" src="{$art.pic2|default='__PUBLIC__/Admin/images/default.png'}" alt="">
                <input type="file" id="pic2" class="pic" val=""/>
                <input type="hidden" name="pic2" value="{$art.pic2}">
              </div>
              <input type="text" style="width:85%"class="input w100" value="{$art.discrip2}" name="discrip2" placeholder="*请输入图片批注" />
              <div class="tips"></div>
            </div>
          </div>
        </div>
        <div>
          <div class="form-group">
            <div class="label">
              <label>文章内容片段：</label>
            </div>
            <div class="field">
              <textarea  name="content2" class="txt" >{$art.content2}</textarea>
              <div class="tips"></div>
            </div>
          </div>
        <!--片段二-->
        <!--片段三-->
          <div class="form-group">
            <div class="label">
              <label>文章图片：</label>
            </div>
            <div class="field">
              <!-- <div class="input w50" data-validate="required:请选择图片">选择图片</div> -->
              <div class="input  field  upload">
                <img id="show_img3" src="{$art.pic3|default='__PUBLIC__/Admin/images/default.png'}" alt="">
                <input type="file" id="pic3" class="pic" val=""/>
                <input type="hidden" name="pic3" value="{$art.pic3}">
              </div>

              <input type="text" style="width:85%"class="input w100" value="{$art.discrip3}" name="discrip3" placeholder="*请输入图片批注" />
              <div class="tips"></div>
            </div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>文章内容片段：</label>
          </div>
          <div class="field">
            <textarea name="content3" class="txt" >{$art.content3}</textarea>
            <div class="tips"></div>
          </div>
        </div>
        <!--片段三-->
        <!--片段四-->
        <notempty name="art.pic4">
          <div class="form-group">
            <div class="label">
              <label>文章图片：</label>
            </div>
            <div class="field">
              <!-- <div class="input w50" data-validate="required:请选择图片">选择图片</div> -->
              <div class="input  field  upload" >
                <img id="show_img4" src="{$art.pic4|default='__PUBLIC__/Admin/images/default.png'}" alt="">
                <input type="file" id="pic4" class="pic" val=""/>
                <input type="hidden" name="pic4" value="{$art.pic4}">
                </div>
                  <input type="text" style="width:85%"class="input w100" value="{$art.discrip4}" name="discrip4" placeholder="*请输入图片批注" />
                  <div class="tips"></div>
                </div>
           </div>
        </notempty>
        <notempty name="art.content4">
            <div class="form-group">
              <div class="label">
                <label>文章内容片段：</label>
              </div>
              <div class="field">
                <textarea name="content4" class="txt" >{$art.content4}</textarea>
                <div class="tips"></div>
              </div>
            </div>
        </notempty>
        <!--片段四-->
        <!--片段五-->
        <notempty name="art.pic5">
          <div class="form-group">
            <div class="label">
              <label>文章图片：</label>
            </div>
            <div class="field">
              <!-- <div class="input w50" data-validate="required:请选择图片">选择图片</div> -->
              <div class="input  field  upload" >
                <img id="show_img5" src="{$art.pic5|default='__PUBLIC__/Admin/images/default.png'}" alt="">
                <input type="file" id="pic5" class="pic" val=""/>
                <input type="hidden" name="pic5" value="{$art.pic5}">
                </div>
                  <input type="text" style="width:85%"class="input w100" value="{$art.discrip5}" name="discrip5" placeholder="*请输入图片批注" />
                  <div class="tips"></div>
                </div>
           </div>
        </notempty>
        <notempty name="art.content5">
            <div class="form-group">
              <div class="label">
                <label>文章内容片段：</label>
              </div>
              <div class="field">
                <textarea name="content5" class="txt" >{$art.content5}</textarea>
                <div class="tips"></div>
              </div>
            </div>
        </notempty>
        <!--片段五-->
        <!--片段六-->
        <notempty name="art.pic6">
          <div class="form-group">
            <div class="label">
              <label>文章图片：</label>
            </div>
            <div class="field">
              <div class="input  field  upload" >
                <img id="show_img6" src="{$art.pic6|default='__PUBLIC__/Admin/images/default.png'}" alt="">
                <input type="file" id="pic6" class="pic" val=""/>
                <input type="hidden" name="pic5" value="{$art.pic5}">
              </div>
              <input type="text" style="width:85%"class="input w100" value="{$art.discrip6}" name="discrip6" placeholder="*请输入图片批注" />
              <div class="tips"></div>
            </div>
          </div>
        </notempty>
        <notempty name="art.content6">
          <div class="form-group">
            <div class="label">
              <label>文章内容片段：</label>
            </div>
            <div class="field">
              <textarea name="content6" class="txt" >{$art.content6}</textarea>
              <div class="tips"></div>
            </div>
          </div>
        </notempty>
        <!--片段六-->
      </eq>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o"  type="submit"> 提交</button>
          <button class="button bg-main icon-check-square-o"  id="add_module" type="button"> 增加模块</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script>
    $('.pic').change(function(){
        var picid = $(this).attr("id");
        var show_img = 'show_img'+picid.slice(3);
        alert(show_img);
        PUB.upload.checkImg(picid,show_img);
        PUB.upload.img_upload(picid,"{:U('Admin/upload/upload')}");
    });
    var now = new Date();
    //格式化日，如果小于9，前面补0
    var day = ("0" + now.getDate()).slice(-2);
    //格式化月，如果小于9，前面补0
    var month = ("0" + (now.getMonth() + 1)).slice(-2);
    //拼装完整日期格式
    var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
    //完成赋值
    // $('.nylDate').val(today);

</script>
</body>
</html>

